#! /bin/bash

set -x
add(){
    echo "1=$1"
    echo "2=$2"
    ret=`expr $1 + $2`
    return $ret
}

sub(){
    echo "1=$1"
    echo "2=$2"
    ret=`expr $1 - $2`
    return $ret
}

mul(){
    echo "1=$1"
    echo "2=$2"
    ret=`expr $1 \* $2`
    return $ret
}

dev(){
    echo "1=$1"
    echo "2=$2"
    ret=`expr $1 / $2`
    return $ret
}

yu(){
    echo "1=$1"
    echo "2=$2"
    ret=`expr $1 % $2`
    return $ret
}

echo -n "please input 2 numbers >: "

read n1 n2

if [ -z $n1 ] || [ -z $n2 ]
then
    echo "n1 or n2 is empty"
    exit 1
fi

add $n1 $n2
echo "$n1+$n2=$?"

sub $n1 $n2
echo "$n1-$n2=$?"

mul $n1 $n2
echo "$n1*$n2=$?"

dev $n1 $n2
echo "$n1/$n2=$?"

yu $n1 $n2
echo "$n1%$n2=$?"

set +x
